package com.example.demolinux;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LoggingAspect {

    @Around("execution(* com.example.demolinux.HelloService.*(..))")
    public Object logExecution(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("[AOP] 调用方法: " + joinPoint.getSignature().getName());
        Object result = joinPoint.proceed();
        System.out.println("[AOP] 返回结果: " + result);
        return result;
    }
}


